package cn.r3.test.controller;

import cn.r3.test.entity.City;
import cn.r3.test.mapper.CityMapper;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/cites")
public class CityController {



    private final CityMapper cityMapper;

    public CityController(CityMapper cityMapper) {
        this.cityMapper = cityMapper;
    }


    @GetMapping("{state}")
    City getCity(@PathVariable String state) {

        return cityMapper.findByState(state);

    }

}
